package com.dongzili.binlog.custom.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dongzili.binlog.common.deserializer.CustomDeserializer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;
import org.dromara.easyes.annotation.*;
import org.dromara.easyes.annotation.rely.FieldType;

import java.time.LocalDateTime;

/**
* 用户访问明细
* @TableName s_browse_log
*/
@Data
@TableName(value ="s_browse_log")
@Settings(maxResultWindow = 100000000)
@IndexName(keepGlobalPrefix = true,value = "s_browse_log")
@JsonDeserialize(using = CustomDeserializer.class)
public class SBrowseLogModel {

	@IndexId(type = org.dromara.easyes.annotation.rely.IdType.CUSTOMIZE)
	@TableId(value="`ID`", type = IdType.AUTO)
    private Long id;

    @IndexField(fieldData = true)
    @TableField("`UserID`")
    private String userID;
    /**
     * 资源关系表ID
     */
    @TableField("`RelationID`")
    private Long relationID;

    @TableField("`ResName`")
    private String resName;

    @TableField("`ResCode`")
    private String resCode;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty("createTime")
    @TableField("`CreateTime`")
    @IndexField( fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @IndexField(fieldData = true)
    @TableField("`CreateTimeYYMM`")
    private String createTimeYYMM;

    @TableField("`CreateTimeMM`")
    private Integer createTimeMM;

    @TableField("`CreateTimeDD`")
    private String createTimeDD;

    @TableField("`LBName`")
    private String lBName;

    @TableField("`LXName`")
    private String lXName;

    @TableField("`Subject`")
    private String subject;

    @TableField("`department`")
    private String department;

    @TableField("`clazz`")
    private String clazz;

    @TableField("`OrgID`")
    private Integer orgID;

    @TableField("`TermName`")
    private String termName;

    @TableField("`SubjectName`")
    private String subjectName;

    @TableField("`FormatName`")
    private String formatName;

//    @IndexField(fieldType = FieldType.KEYWORD, fieldData=true)
    @TableField("`LibraryName`")
    private String libraryName;

    @TableField("`ResTypeName`")
    private String resTypeName;

    @TableField("`UserName`")
    private String userName;

    @IndexField(fieldData = true)
    @TableField("`IsDelete`")
    private Boolean isDelete;

    @TableField("`IsHits`")
    private Boolean isHits;

    @TableField("`IP`")
    private String iP;

    @TableField("`RealName`")
    private String realName;

    @TableField("`IsPC`")
    private Boolean isPC;

    @TableField("`sourceType`")
    private Integer sourceType;

    /**
     * 浏览时长
     */
    @TableField("`duration`")
    private Integer duration;


    /**
    * 更新时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty("modifyTime")
    @TableField("`modify_time`")
    @IndexField( fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime modifyTime;

    @IndexField(exist = false)
    @TableField(exist = false)
    private Integer total;



    /**
    * 匹配度
    */
    @Score
    @IndexField(exist = false)
    @TableField(exist = false)
    private Float matchScore;

    /**
     * 开始时间
     */
    @IndexField(exist = false)
    @TableField(exist = false)
    private String startTime;
    /**
     * 结束时间
     */
    @IndexField(exist = false)
    @TableField(exist = false)
    private String endTime;

}
